package com.ks.search.controller;


import com.atguigu.commonutils.R;
import com.atguigu.vo.MenuSearchVo;
import com.atguigu.vo.MenuVo;
import com.atguigu.vo.SearchVo;
import com.ks.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    SearchService service;

    //向es中添加菜谱数据
    @PostMapping("addmenuvo")
    public R addMenuVo(@RequestBody MenuSearchVo menuSearchVo){
        service.addMenu(menuSearchVo);
        return R.ok();
    }

    //根据食材推荐菜谱
    @PostMapping("getmenus")
    public List<MenuVo> getMenus(@RequestBody SearchVo searchVo){
        return service.getMenus(searchVo);
    }


}
